//
//  ZXNavigationControllerExtension.swift
//  ExtensionTest
//
//  Created by ZX on 2025/2/8.
//

import UIKit

public extension UINavigationController{
    func popNumber(number: Int,animated: Bool){
        let count = viewControllers.count
        if count > number {
            let targetViewController = viewControllers[count - 1 - number]
            self.popToViewController(targetViewController, animated: animated)
        } else {
            // 处理视图控制器数量不足的情况
           self.popToRootViewController(animated: animated)
        }
    }
}


